package com.topnav.mc.admin.service;

import com.js.lib.result.Result;
import com.topnav.mc.admin.bean.cachebean.CacheDeviceFenceBean;
import com.topnav.mc.admin.bean.cachebean.CacheFencePolygonBean;
import com.topnav.mc.admin.entity.Device;
import com.topnav.mc.admin.entity.Fence;
import com.topnav.mc.admin.entity.bean.FenceBean;
import com.topnav.mc.admin.entity.param.FenceParam;
import com.topnav.mc.base.mc.IMcService;

import java.util.List;

/**
 * @Author: kenny
 * @Date: 2023/11/13 10:50
 */
public interface IFenceService extends IMcService<Fence, FenceBean, FenceParam> {

    /**
     * 根据部门ID查围栏树
     * @param pid
     * @return
     */
    Result findFenceTree(String pid);


    /**
     * 按关键字查询围栏树
     * @param keyword
     * @return
     */
    Result searchBykeyword(String keyword);

    /**
     * 保存到缓存
     */
    void saveToCache(FenceBean fenceBean);
    void saveAllToCache();
    void removeFromCache(Long id);

    /**
     * 从缓存取设备
     */
    CacheFencePolygonBean getFromCache(Long id);
    List<CacheFencePolygonBean> getAllFromCache();

    /**
     * 保存设备围栏状态
     * @param cacheDeviceFenceBean
     */
    void setDeviceFenceStatusToCache(CacheDeviceFenceBean cacheDeviceFenceBean);

    /**
     * 取得设备围栏状态
     * @param key // deviceId + "-" + fenceId
     */
    CacheDeviceFenceBean getDeviceFenceStatusFromCache(String key);

}
